package com.jwgf.Half485.fxthreadpool;

import com.jwgf.Half485.CommandQueueAction;

public class FxAction implements CommandQueueAction {
    @Override
    public CMD_QUEUE_ACTION act(Object data) {
        FxData fxData = (FxData) data;
        String cmdType = FxUtils.checkCmdType(fxData.send);
        if (cmdType.equals(FxUtils.WW)) {
            if (fxData.isDone) {
                FxPLCData.getInstance().writeSucceed(fxData);
            } else {
                FxPLCData.getInstance().writeFailed(fxData);
            }
            return CMD_QUEUE_ACTION.NEXT;
        } else {
            if (fxData.isDone) {
                FxPLCData.getInstance().readSucceed(fxData);
                return CMD_QUEUE_ACTION.NEXT;
            } else {
                FxPLCData.getInstance().readFailed(fxData);
                return CMD_QUEUE_ACTION.REPEAT;
            }

        }
    }
}
